Objective
Process Control statement:
In the process of executing a program, the order of execution of each statement has a direct effect on the result of the program. That is to say, the process of the program has a direct impact on the running
Java programming those things 34 -- switch statement syntax Zhengzhou game college Chen yuefeng from: http://blog.csdn.net/mailbomb
5.3.2 switch statementThe Chinese meaning of the switch keyword is the meaning of switch and conversion. The switch
A switch statement consists of a control expression and multiple case labels.The types supported by the switch control expressions are byte, short, char, int, enum (Java 5), String (Java 7).The Switch-case statement can be fully interoperable with
Multi-Select structure switch statement
In Java, a switch statement is specifically provided for the multipath branching selection process, and the switch statement chooses one of the multiple operations to run based on the value of one expression.
The early development of the time has been used in C + +, and later mainly Java. You need to use C # recently.Familiar with the next C #, found that the C # language on the basis of a lot of simplification, and reference to a lot of Java grammar
Switch syntax The code is as follows:Copy code Switch (expression){Case constant expression 1: Statement 1;....Case constant expression 2: Statement 2;Default: statement;} Default is to execute it if there is no matching case. default is not
casts of data types
public class example2{
int i=97;
Char c= (char) i; Cast of type
System.out.println ("c=" +c);
}
Hundred Record Entry dialog box
Import javax.swing.joptionpane;//dialog box to eject the method in the required package
public class
Java programming those things 31 -- If statement syntax (1) Zhengzhou game institute Chen yuefeng from: http://blog.csdn.net/mailbomb
5.3 condition statementsConditional statements are a type of statements that are selected and executed based on the
Detailed description of the basic syntax of java, java syntax
【Preface]
Java syntax begins with basic syntax.ClassAndObjectThe object and class are composedMethodAndVariableAnd methods includeStatementAndExpression.
Object(Almost) Everything is an
JAVA if Condition Statement, switch multi-branch structure, and logical operators, switch operators
I. if condition statements
Example:
Import java. util. role; public class Test {public static void main (String [] args) {role in = new role (System.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.